/**
 * 
 */
package com.neal.domain.securities;

import java.util.List;
import java.util.UUID;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.neal.domain.enums.ResourceType;

/**
 * @author Neal
 * @version 1.0
 * @description 系统资源
 */
@Entity
@Table(name = "SYS_RESOURCE")
public class Resources {

	@Id
	@Column(name = "RES_ID", length = 36)
	private String id;

	@Column(name = "RES_NAME", length = 20)
	private String name;

	@Column(name = "RES_PRIORITY")
	private Integer priority;

	@Column(name = "RES_DESC", length = 255)
	private String descript;

	@Column(name = "RES_TYPE", length = 20)
	@Enumerated(EnumType.STRING)
	private ResourceType resourceType;

	@Column(name = "RES_URL", length = 255)
	private String url;

	@ManyToOne
	@JoinColumn(name = "RES_PARENT_ID")
	private Resources parent;
	
	@ManyToMany(mappedBy="resources")
	private List<Role> roles;
	
	public Resources() {
		this.id = UUID.randomUUID().toString();
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getPriority() {
		return priority;
	}

	public void setPriority(Integer priority) {
		this.priority = priority;
	}

	public String getDescript() {
		return descript;
	}

	public void setDescript(String descript) {
		this.descript = descript;
	}

	public ResourceType getResourceType() {
		return resourceType;
	}

	public void setResourceType(ResourceType resourceType) {
		this.resourceType = resourceType;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public Resources getParent() {
		return parent;
	}

	public void setParent(Resources parent) {
		this.parent = parent;
	}

	
	public List<Role> getRoles() {
		return roles;
	}

	
	public void setRoles(List<Role> roles) {
		this.roles = roles;
	}

}
